package xjh.him.util;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class ThreadPoolUtil {
    private static final ExecutorService executor = Executors.newFixedThreadPool(20);

    public static void exec(Runnable task) {
        executor.execute(task);
    }

    public static Future<?> submit(Callable<?> task) {
        return executor.submit(task);
    }

    public static void closeExecutor() {
        executor.shutdownNow();
    }
}
